package com.esun;

import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.core.env.Environment;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@SpringBootApplication
@EnableSwagger2
@MapperScan({"com.esun.payment_api.mapper","com.esun.gateway.mapper","com.esun.workflow.mapper"})
public class PaymentApiApplication  extends SpringBootServletInitializer {

    private static final Logger LOG = LoggerFactory.getLogger(PaymentApiApplication.class);

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(PaymentApiApplication.class);
    }

    public static void main(String[] args) {

        SpringApplication app = new SpringApplication(PaymentApiApplication.class);

        Environment env = app.run(args).getEnvironment();

        LOG.info("App Started successful");
        LOG.info("Address:http://127.0.0.1:" + env.getProperty("server.port"));

        System.out.println("(♥◠‿◠)ﾉﾞ  应用启动成功   ლ(´ڡ`ლ)ﾞ  \n" +
                "          _____                    _____                    _____                    _____          \n" +
                "         /\\    \\                  /\\    \\                  /\\    \\                  /\\    \\         \n" +
                "        /::\\    \\                /::\\    \\                /::\\____\\                /::\\____\\        \n" +
                "       /::::\\    \\              /::::\\    \\              /:::/    /               /::::|   |        \n" +
                "      /::::::\\    \\            /::::::\\    \\            /:::/    /               /:::::|   |        \n" +
                "     /:::/\\:::\\    \\          /:::/\\:::\\    \\          /:::/    /               /::::::|   |        \n" +
                "    /:::/__\\:::\\    \\        /:::/__\\:::\\    \\        /:::/    /               /:::/|::|   |        \n" +
                "   /::::\\   \\:::\\    \\       \\:::\\   \\:::\\    \\      /:::/    /               /:::/ |::|   |        \n" +
                "  /::::::\\   \\:::\\    \\    ___\\:::\\   \\:::\\    \\    /:::/    /      _____    /:::/  |::|   | _____  \n" +
                " /:::/\\:::\\   \\:::\\    \\  /\\   \\:::\\   \\:::\\    \\  /:::/____/      /\\    \\  /:::/   |::|   |/\\    \\ \n" +
                "/:::/__\\:::\\   \\:::\\____\\/::\\   \\:::\\   \\:::\\____\\|:::|    /      /::\\____\\/:: /    |::|   /::\\____\\\n" +
                "\\:::\\   \\:::\\   \\::/    /\\:::\\   \\:::\\   \\::/    /|:::|____\\     /:::/    /\\::/    /|::|  /:::/    /\n" +
                " \\:::\\   \\:::\\   \\/____/  \\:::\\   \\:::\\   \\/____/  \\:::\\    \\   /:::/    /  \\/____/ |::| /:::/    / \n" +
                "  \\:::\\   \\:::\\    \\       \\:::\\   \\:::\\    \\       \\:::\\    \\ /:::/    /           |::|/:::/    /  \n" +
                "   \\:::\\   \\:::\\____\\       \\:::\\   \\:::\\____\\       \\:::\\    /:::/    /            |::::::/    /   \n" +
                "    \\:::\\   \\::/    /        \\:::\\  /:::/    /        \\:::\\__/:::/    /             |:::::/    /    \n" +
                "     \\:::\\   \\/____/          \\:::\\/:::/    /          \\::::::::/    /              |::::/    /     \n" +
                "      \\:::\\    \\               \\::::::/    /            \\::::::/    /               /:::/    /      \n" +
                "       \\:::\\____\\               \\::::/    /              \\::::/    /               /:::/    /       \n" +
                "        \\::/    /                \\::/    /                \\::/____/                \\::/    /        \n" +
                "         \\/____/                  \\/____/                  ~~                       \\/____/         \n" +
                "                                                                                                    ");
    }

}
